
#import database
import climber
import slope
import contest
import threading, thread
import controller
import gui 
import time

__version__='0.1'
__license__='LGPL'

def test():
	import doctest
	contest.RAISE_EXCEPTION = False
	for module in [climber, contest, slope]:
		_doctests = doctest.DocTestFinder().find(module)
		for _doctest in _doctests:
			doctest.DocTestRunner().run(_doctest)


if __name__ == "__main__":
#	test()
	
	from contest import Contest
	from gui import GUI
	from controller import Controller
	import gtk
	
	compet = Contest()

	compet.load(True)
	mutex = threading.Semaphore()

	gtk.gdk.threads_init()
	
	gtk.gdk.threads_enter()
	controller = Controller(compet, mutex)
	controller.start()
	gtk.gdk.threads_leave()
	
	gui = GUI(compet, mutex)
	gtk.main()